package Student_information.Controller;

import Student_information.Service.LoginService;

import java.util.Scanner;

public class Login {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        //用于控制循环条件
        boolean flag = true;

        //用于存储findUser返回值
        boolean Login_flag = false;

        //创建对象
        LoginService ls = new LoginService();
        StudentManage sm = new StudentManage();

        while (flag) {
            System.out.println("请输入用户名：");
            String uname = sc.nextLine();
            System.out.println("请输入密码:");
            String pwd = sc.nextLine();
            //判断
            Login_flag = ls.findUser(uname, pwd);
            if (Login_flag) {//正确
                System.out.println("登录成功，马上进入系统！");
                sm.Oper();
                flag = false;
            } else {//错误
                System.out.println("登录失败，请重新输入");
            }
        }
    }
}
